There is an increasing commercial importance for systems that are capable of automatically identifying cargo containers or vehicle license plates. Container code, as a standard marking on the container, is a unique identification code that appears on several places in a container. Similarly, the vehicle license plate also uniquely identifies a vehicle. In recent years, computer vision technology has been developed to provide a cost-effective solution in reading this alphanumeric code. In this scenario, cameras are used to take an image that contains the identification code. Then image processing and optical character recognition (OCR) technologies are used to recognize the container code. Due to dirt or other uncontrollable circumstances, the container code or vehicle license number may not be clearly captured in a digital image. An example situation is that the object (the container or vehicle) is moving relative to the camera when the image is captured, so the characters are smeared in one or more direction. Another example is that the lighting conditions make the characters indistinguishable fro the background. In such cases, the recognition accuracy suffers.